import request from '@/utils/request'
import qs from 'qs'

// 获取列表数据
export function listProjects (pageIndex, pageSize = 20) {
  return request({
    url: '/service-process/v1/meta/projects',
    method: 'get',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    params: { pageIndex, pageSize }
  })
}
// 添加
export function addProject (data) {
  // console.log(data)
  return request({
    url: '/service-process/v1/meta/project',
    method: 'post',
    data: data
  })
}
// 修改
export function editProject (data) {
  console.log("调用接口处的",data)
  return request({
    url: '/service-process/v1/meta/project',
    method: 'put',
    data: data
  })
}
// 删除
export function delProject (id) {
  return request({
    url: '/service-process/v1/meta/project',
    method: 'delete',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data: qs.stringify({ id })
  })
}
// export function delProject (id) {
//   console.log("调用接口处的id",id)
//   return request({
//     url: 'meta/project',
//     method: 'delete',
//     headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
//     data: qs.stringify({ id })
//   })
// }

// 暂时获取总条数
export function listAllProjects () {
  return request({
    url: '/service-process/v1/meta/project/name',
    method: 'get'
  })
}
